<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>积分明细</title>
<!-- <link type="text/css" href="__CSS__/main.css?v={$src_version}" rel="stylesheet"/> -->
<link type="text/css" href="__CSS__/wild.css?v={$src_version}" rel="stylesheet"/>
<script type="text/javascript" src="__PUBLIC_JS__/jquery.js?v={$src_version}" ></script>
</head> 
<body>
<div class="reback"><img src="__IMG__/reback.svg" onclick="javascript:history.back(-1);"></div>
<div class="accumulate_head">
        <if condition="$user['headimgurl'] neq ''"><img src="/{$user.headimgurl}" /><else /><img src="__IMG__/accumulate/accumulate_head.png">
        <p></if><span>{$user.realname}</span></p>
        <div class="des"><span class="accumulate_integral">{$num[0]['upoint']}</span><p class="text">积分<br/>余额</p></div>
    </div>
    <ul class="accumulate-filter">
        <li id="all" data-id="" class="active"><a >全部</a></li>
        <li id="add" data-id="add"><a >加分</a></li>
        <li id="less" data-id="less"><a >减分</a></li>
    </ul> 
    <div class="accumulate-box">
    </div>
</div>  
</body>
</html>
<script>
    var pattern = new RegExp("[+]")
    $('.subtraction').each(function(){
        if(pattern.test($(this).text())){
            $(this).css('color','#cc0000')
        }
    })
//ajax页面替换
ajaxall("/user/jifen",'');//页面内容初始化
$('.accumulate-filter li').click(function(){
    $(this).addClass('active').siblings().removeClass('active');
    var cent=$(this).attr('data-id');
    ajaxall("/user/jifen",cent);
})
function ajaxall(url,cent){
    $.ajax({
        type: "GET",
        data:{
            cent:cent,
        },
        url: "{:U('User/jifen')}",
        success:function(res){
           if(code="200"){
               $('.accumulate-box').html('');
                var str='';
              for (let i = 0; i < res.data.length; i++) {
                   if(res.data[i].type=='add'){
                       str+='<div class="accumulate-item">\
                                <div class="item-left">\
                                    <p style="display:none">'+res.data[i].add_id+'</p>\
                                    <p>'+res.data[i].update_time+'</p>\
                                    <p>'+res.data[i].note+'</p>\
                                </div>\
                                <span class="item-right right bonus">+'+res.data[i].upoint_add+'</span>\
                            </div>';
                   }else{
                       str+='<div class="accumulate-item">\
                                <div class="item-left">\
                                    <p style="display:none">'+res.data[i].add_id+'</p>\
                                    <p>'+res.data[i].update_time+'</p>\
                                    <p>'+res.data[i].note+'</p>\
                                </div>\
                                <span class="item-right right subtraction">-'+res.data[i].upoint_add+'</span>\
                            </div>';
                   }
               }
           }
              $('.accumulate-box').append(str);
        }
    })
}
//高亮
    // var position=window.location.href;
    // var index = position .lastIndexOf("\/");
    // str= position.substring(index + 1, position.length);
    // if(str=='mypointdetail'){
    //     $('#all').css('border-bottom','1px solid #83a500');
    //     $('#all').children('a').css('color','#83a500')
    // }else if(str=='add'){
    //     $('#add').css('border-bottom','1px solid #83a500');
    //     $('#add').children('a').css('color','#83a500')
    // }else if(str=='less'){
    //     $('#less').css('border-bottom','1px solid #83a500');
    //     $('#less').children('a').css('color','#83a500')
    // }
</script>